import { MinimalButton, Position, Tooltip } from "../../core";

import { RenderSwitchSelectionModeProps } from "./SwitchSelectionMode";
import SwitchSelectionModeDecorator from "./SwitchSelectionModeDecorator";
import { FC } from "react";

const TOOLTIP_OFFSET = { left: 0, top: 8 };

const SwitchSelectionModeButton: FC<RenderSwitchSelectionModeProps> = ({
  isSelected,
  mode,
  onClick,
}) => (
  <SwitchSelectionModeDecorator mode={mode} onClick={onClick}>
    {(props) => (
      <Tooltip
        position={Position.BottomCenter}
        target={
          <MinimalButton isSelected={isSelected} onClick={props.onClick}>
            {props.icon}
          </MinimalButton>
        }
        content={() => props.label}
        offset={TOOLTIP_OFFSET}
      />
    )}
  </SwitchSelectionModeDecorator>
);

export default SwitchSelectionModeButton;
